{extend name="public/base"}

{block name="title"}
合伙人团队
{/block}

{block name="style"}
{css href="/static/wechat/css/index.css" /}
<style>
    .weui-cells_checkbox .weui-check:disabled+.weui-icon-checked:before {
        content: '\EA06';
        color: #CCCCCC;
    }
</style>
{/block}

{block name="body"}
<div class="pageControl team">
    <div class="msui_nav msui_navTop distribution">
        <a class="msui_navTop-back" href="javascript:history.back();"><i class="micon-back"></i></a>
        <h1 class="msui_navTop-title">管理区域分配</h1>
        <a href="javascript:;" class="msui_navTop-right save">保存</a>
    </div>
    <div class="weui-top">
        <form action="?" method="post">
            <div class="weui-cells weui-cells_checkbox">
                {volist name="data" id="vo"}
                <label for="s{$i}" class="weui-cell weui-check__label">
                    {php} if(in_array($vo['region_id'], $old_area)) { {/php}
                    <div class="weui-cell__hd">
                        <input id="s{$i}" type="checkbox" name="region_id[]" checked class="weui-check" value="{$vo.region_id}"/>
                        <span class="weui-icon-checked"></span>
                    </div>
                    {php} } else { {/php}
                    <input id="s{$i}" type="checkbox" name="region_id[]" {gt name="vo.maid" value="0"} disabled {/gt} class="weui-check" value="{$vo.region_id}"/>
                    <span class="weui-icon-checked"></span>
                    {php} } {/php}
                    <div class="weui-cell__bd">
                        <p>{$vo.region_name}</p>
                    </div>
                </label>
                {/volist}
            </div>
            <input type="hidden" name="partner_id" value="{$id}">
        </form>
    </div>
</div>
{/block}
{block name="javascript"}
<script>
    $(".save").click(function () {
        var obj = $("form");
        $.ajax({
            type : obj.attr('method'),
            url: obj.attr('action'),
            data: obj.serialize(),
            dataType: 'json',
            success: function (msg) {
                console.log(msg);
                if (msg.code == 200) {
                    window.location.href = '{:url("partner_info", ["id" => $id])}';
                }
            }
        });
    });
</script>
{/block}